/**
 * Project  : monkey
 * Author   : Wu Tian Qiang
 * Date     : 2016/10/24 17:10:51
 */
Ext.define('Monkey.view.permission.Permission', {
    extend: 'Ext.panel.Panel',

    id: 'mk-permission',
    controller: 'ctrl-permission',
    layout: 'fit',
    tbar: [{
        xtype: 'tbtext',
        html: '权限管理'
    }, '-', {
        icon: 'resources/icons/16/lightning_add.png',
        text: '新增',
        handler: 'addPermission'
    }, '-', {
        icon: 'resources/icons/16/lightning_go.png',
        text: '修改',
        handler: 'modifyPermission'
    }, '-', {
        icon: 'resources/icons/16/lightning_delete.png',
        text: '删除',
        handler: 'removePermission'
    }, '->', {
        xtype: 'textfield',
        reference: 'name',
        emptyText: '输入要查询名称...',
        labelAlign: 'right',
        fieldLabel: '名称'
    }, {
        xtype: 'textfield',
        reference: 'permission',
        emptyText: '输入要查询权限标识...',
        labelAlign: 'right',
        labelWidth: 60,
        fieldLabel: '权限标识'
    }, {
        iconCls: 'page-find',
        text: '查询',
        handler: 'findPermission'
    }, {
        iconCls: 'refresh',
        text: '重置',
        handler: 'reloadPermission'
    }],
    initComponent: function () {
        var store = Ext.create('Monkey.store.permission.Permission');
        this.items = [{
            id: 'permissionGrid',
            xtype: 'grid',
            reference: 'permissionGrid',
            selType: 'checkboxmodel',
            store: store,
            listeners: {
                rowdblclick: 'rowdblclick'
            },
            bbar: {
                xtype: 'pagingtoolbar',
                pageSize: 10,
                store: store,
                displayInfo: true,
                plugins: new Ext.ux.ProgressBarPager()
            },
            columns: [{
                width: 30,
                xtype: 'rownumberer'
            }, {
                text: 'id',
                dataIndex: 'id',
                hidden: true,
                width: 100
            }, {
                text: '名称',
                dataIndex: 'name',
                width: 150
            }, {
                text: '权限标识',
                dataIndex: 'permission',
                width: 150
            }, {
                text: '详细描述',
                dataIndex: 'description',
                flex: 1
            }]
        }];
        this.callParent();
    }
});